package day01;

import java.util.*;

public class demo1 {
    public static void main(String[] args) {
        demo d = new demo();
        d.age =10;
        List<demo> list = new ArrayList<>();
        list.add(d);

        System.out.println(list.stream().iterator().next().age);
        for (demo d1 :list){
            d1.setAge(20);
        }
        System.out.println("-----------------------");
        System.out.println(list.stream().iterator().next().age);
    }




}
class demo {

    int age =1;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}